<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateRegistryAuthsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('registry_auths', function (Blueprint $table) {
            $table->id();
            $table->timestamps();
            $table->softDeletes();
            $table->bigInteger('user_id')->index()->comment('用户ID');
            $table->string('auth_type', 16)->comment('认证类型');
            $table->string('auth_name', 32)->comment('认证名称');

            # 个人
            $table->string('id_card_no', 32)->nullable()->comment('个人身份证号');
            $table->string('id_card_image_front', 256)->nullable()->comment('身份证正面照');
            $table->string('id_card_image_back', 256)->nullable()->comment('身份证背面照');
            $table->string('gender', 8)->nullable()->comment('性别');
            $table->string('nation', 8)->nullable()->comment('民族');

            # 企业
            $table->string('license_no', 32)->nullable()->comment('公司营业执照号');
            $table->string('license_image', 256)->nullable()->comment('营业执照照片');
            $table->string('license_expire_date', 32)->nullable()->comment('营业执照有效期');

            $table->string('address', 128)->comment('个人或公司地址');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('registry_auths');
    }
}
